{extend name='common/content' /}


{block name="content"}

<div class="layui-form">
    <form id="export-form" onsubmit="return false;" data-auto="" method="POST">
        <table class="table table-hover">
            <thead>
            <tr>
                <th class='text-center'>备份名称</th>
                <th class='text-center'>卷数</th>
                <th class='text-center'>压缩</th>
                <th class='text-center'>数据大小</th>
                <th class='text-center'>备份时间</th>
                <th class='text-center'>操作</th>
            </tr>
            </thead>
            <tbody>
            {foreach $list as $key=>$vo}
            <tr>
                <td class='text-center'>{$vo.name|date='Ymd-His',###}</td>
                <td class='text-center'>{$vo.part}</td>
                <td class='text-center'>{$vo.compress}</td>
                <td class='text-center'>{$vo.size|format_bytes}</td>
                <td class='text-center'>{$vo.time|date='Y-m-d H:m:s',###}</td>
                <td class='text-center'>
                    <!--{if auth("$classuri/download")}
                    &lt;!&ndash;<a href='{:url("$classuri/download")}?id={$vo.name}'>下载</a>&ndash;&gt;
                    {/if}
                    {if auth("$classuri/import")}
                    <span class="text-explode">|</span>
                    <a data-update="{$vo.name}" data-field='import' data-action='{:url("$classuri/import")}'
                       href="javascript:void(0)">还原</a>
                    {/if}
                    {if auth("$classuri/del")}
                    <span class="text-explode">|</span>
                    <a data-update="{$vo.name}" data-field='filename' data-action='{:url("$classuri/del")}'
                       href="javascript:void(0)">删除</a>
                    {/if}-->

                    <div class="layui-btn-group">
                        {if auth("$classuri/import")}
                        <button type="button" data-update="{$vo.name}" data-field='import' data-action='{:url("$classuri/import")}' class="layui-btn layui-btn-primary layui-btn-small">还原</button>
                        {/if}

                        {if auth("$classuri/del")}
                        <button type="button" data-update="{$vo.name}" data-field='filename' data-action='{:url("$classuri/del")}' class="layui-btn layui-btn-primary layui-btn-small"><i class="layui-icon"></i></button>
                        {/if}
                    </div>
                </td>
            </tr>
            {/foreach}
            </tbody>
        </table>
    </form>
</div>



<script>window.form.render();</script>


<script>
    layui.use('form', function(){
        var $ = layui.jquery
            , form = layui.form;

        //全选
        form.on('checkbox(allChoose)', function(data){
            var child = $(data.elem).parents('table').find('tbody input[type="checkbox"]');
            child.each(function(index, item){
                item.checked = data.elem.checked;
            });
            form.render('checkbox');
        });

    });
</script>

<script>
    layui.use('element', function(){
        var $ = layui.jquery
            ,element = layui.element; //Tab的切换功能，切换事件监听等，需要依赖element模块

        //触发事件
        var active = {
            tabAdd: function(){
                //新增一个Tab项
                element.tabAdd('demo', {
                    title: '新选项'+ (Math.random()*1000|0) //用于演示
                    ,content: '内容'+ (Math.random()*1000|0)
                    ,id: new Date().getTime() //实际使用一般是规定好的id，这里以时间戳模拟下
                })
            }
            ,tabDelete: function(othis){
                //删除指定Tab项
                element.tabDelete('demo', '44'); //删除：“商品管理”


                othis.addClass('layui-btn-disabled');
            }
            ,tabChange: function(){
                //切换到指定Tab项
                element.tabChange('demo', '22'); //切换到：用户管理
            }
        };

        $('.site-demo-active').on('click', function(){
            var othis = $(this), type = othis.data('type');
            active[type] ? active[type].call(this, othis) : '';
        });

        //Hash地址的定位
        var layid = location.hash.replace(/^#test=/, '');
        element.tabChange('test', layid);

        element.on('tab(test)', function(elem){
            location.hash = 'test='+ $(this).attr('lay-id');
        });

    });
</script>

{/block}